import {createRouter, createWebHashHistory, RouteRecordRaw} from "vue-router"

const routes: RouteRecordRaw[] = [
    {
        path: "/",
        redirect: "/departure-station"
    },
    {
        path: "/index",
        name: "index",
        component: () => import("@/pages/index/index.vue"),
        meta: {
            title: "首页"
        },
        children: [
            {
                path: "/",
                redirect: "/departure-station"
            },
            {
                path: "/departure-station",
                name: "departure-station",
                component: () => import("@/pages/index/components/departure-station/index.vue"),
                meta: {
                    title: "启航站"
                }
            },
            {
                path: "/creative-workshop",
                name: "creative-workshop",
                component: () => import("@/pages/index/components/creative-workshop/index.vue"),
                meta: {
                    title: "创想工坊"
                }
            },
            {
                path: "/time-imprint",
                name: "time-imprint",
                component: () => import("@/pages/index/components/time-imprint/index.vue"),
                meta: {
                    title: "时光印记"
                }
            },
            {
                path: "/inspiration-whispers",
                name: "inspiration-whispers",
                component: () => import("@/pages/index/components/inspiration-whispers/index.vue"),
                meta: {
                    title: "灵感絮语"
                }
            },
            {
                path: "/contact-us",
                name: "contact-us",
                component: () => import("@/pages/index/components/contact-us/index.vue"),
                meta: {
                    title: "联系我们"
                }
            }
        ]
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes: routes
})

router.beforeEach(async (to, from, next) => {
    next()
})

export default router
